package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.ProductDao;
import com.cn.wanxi.dao.impl.ProductImpl;
import com.cn.wanxi.model.ProductModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.ProductService;

public class ProductServiceImpl implements ProductService {
    private ProductDao productDao=new ProductImpl();
    @Override
    public ResultModel add(ProductModel productModel) {
       return ResultModel.getResult(productDao.add(productModel));
    }

    @Override
    public ResultModel update(ProductModel productModel) {
        return ResultModel.getResult(productDao.update(productModel));
    }

    @Override
    public ResultModel delete(ProductModel productModel) {
        return ResultModel.getResult(productDao.delete(productModel));
    }

    @Override
    public ResultModel findById(ProductModel productModel) {
        return ResultModel.getResult(productDao.findById(productModel));
    }

    @Override
    public ResultModel findAll(ProductModel productModel) {
        return ResultModel.getResult(productDao.getCount(productModel),productDao.findAll(productModel));
    }

    @Override
    public ResultModel getCount(ProductModel productModel) {
        return ResultModel.getResult(productDao.getCount(productModel));
    }
}
